<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

$api = app('Dingo\Api\Routing\Router');
$api->version('v1', function ($api) {
    $api->group(['namespace' => 'App\Http\Controllers\Api\V1'], function ($api){
        // 需要登陆认证
//        $api->group(['middleware' => 'api'], function ($api) {
            require(__DIR__ . '/goods.php');//商品路由
            require(__DIR__ . '/vuls.php');//漏洞路由
            require(__DIR__ . '/user.php');//用户
            require(__DIR__ . '/order.php');//订单
//        });
        //不需要登陆认证
        //首页
        //积分排行
        require(__DIR__ . '/credit.php');//积分相关
        //商品列表
        $api->get('searchmergelists/{type?}/{name?}', 'Goods\GoodsController@searchMergeLists'); //组合搜索
        //公告相关
        require(__DIR__ . '/announce.php');
        //登陆例外
        $api->get('getssologinaddress', 'User\UserController@getSsoLoginAddress');
        //获取表单token
        $api->get('getcsrftoken', 'BaseController@getCsrfToken');
        //登出
        $api->get('getssologout', 'User\UserController@logout')->name('logout');
    });
});
